package com.cnswhy.cloud.server.core.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.cnswhy.cloud.common.core.base.entity.Entity;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import com.cnswhy.cloud.server.common.entity.enumeration.AgentLevelType;
import com.cnswhy.cloud.server.common.entity.enumeration.BranchLevelType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.cnswhy.cloud.common.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 
 * </p>
 *
 * @author cnswhy
 * @since 2020-10-18
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("t_customer")
@ApiModel(value = "Customer", description = "")
@AllArgsConstructor
public class Customer extends Entity<Long> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "")
    @Length(max = 11, message = "长度不能超过11")
    @TableField(value = "login_name", condition = LIKE)
    @Excel(name = "注册手机号")
    private String loginName;

    @ApiModelProperty(value = "")
    @Length(max = 50, message = "长度不能超过50")
    @TableField(value = "pass_word", condition = LIKE)
    @Excel(name = "")
    private String passWord;

    @ApiModelProperty(value = "")
    @TableField("promoter_id")
    @Excel(name = "")
    private Long promoterId;

    @ApiModelProperty(value = "")
    @TableField("create_date")
    @Excel(name = "", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime createDate;

    /**
     * 0普通用户1经销商2城市区域代理
     */
    @ApiModelProperty(value = "0普通用户1经销商2城市区域代理")
    @TableField("customer_type")
    @Excel(name = "用户类型")
    private Integer customerType;

    /**
     * 总积分
     */
    @ApiModelProperty(value = "总积分")
    @TableField("total_profit")
    @Excel(name = "总积分")
    private BigDecimal totalProfit;

    /**
     * 账户余额
     */
    @ApiModelProperty(value = "账户余额")
    @TableField("available_balance")
    @Excel(name = "账户余额")
    private BigDecimal availableBalance;

    /**
     * 0正常1禁用2未激活
     */
    @ApiModelProperty(value = "0正常1禁用2未激活")
    @TableField("status")
    //    @Excel(name = "交易类型", replace = {"提现_WITHDRAW", "充值_CHARGE",  "_null"})
    @Excel(name = "状态", replace = {"正常_0", "禁用_1",  "未激活_2"})
    private Integer status;

    @ApiModelProperty(value = "")
    @Length(max = 11, message = "长度不能超过11")
    @TableField(value = "promoter_mobile", condition = LIKE)
    @Excel(name = "推荐人手机号")
    private String promoterMobile;

    /**
     * 交易密码
     */
    @ApiModelProperty(value = "交易密码")
    @Length(max = 100, message = "交易密码长度不能超过100")
    @TableField(value = "trade_pass", condition = LIKE)
    @Excel(name = "")
    private String tradePass;

    /**
     * 拼购券总量
     */
    @ApiModelProperty(value = "拼购券总量")
    @TableField("total_coupon")
    @Excel(name = "拼购券总量")
    private BigDecimal totalCoupon;

    /**
     * 可用拼购券
     */
    @ApiModelProperty(value = "可用拼购券")
    @TableField("coupon")
    @Excel(name = "可用拼购券")
    private BigDecimal coupon;

    @ApiModelProperty(value = "")
    @Length(max = 50, message = "长度不能超过50")
    @TableField(value = "real_name", condition = LIKE)
    @Excel(name = "")
    private String realName;

    @ApiModelProperty(value = "")
    @Length(max = 255, message = "长度不能超过255")
    @TableField(value = "head_img", condition = LIKE)
    @Excel(name = "")
    private String headImg;

    @ApiModelProperty(value = "")
    @Length(max = 50, message = "长度不能超过50")
    @TableField(value = "nick_name", condition = LIKE)
    @Excel(name = "昵称")
    private String nickName;

    /**
     * 拼团值
     */
    @ApiModelProperty(value = "拼团值")
    @TableField("spell_value")
    @Excel(name = "拼团值")
    private BigDecimal spellValue;

    /**
     * 贡献值
     */
    @ApiModelProperty(value = "贡献值")
    @TableField("contribution_value")
    @Excel(name = "贡献值")
    private Long contributionValue;

    /**
     * 是否有参团 1没有2有 默认1
     */
    @ApiModelProperty(value = "是否有参团 1没有2有 默认1")
    @TableField("is_spell")
    @Excel(name = "")
    private Integer isSpell;

    /**
     * 拼团收益
     */
    @ApiModelProperty(value = "拼团收益")
    @TableField("spell_balance")
    @Excel(name = "拼团收益")
    private BigDecimal spellBalance;

    /**
     * 贡献收益
     */
    @ApiModelProperty(value = "贡献收益")
    @TableField("contribution_balance")
    @Excel(name = "贡献收益")
    private BigDecimal contributionBalance;

    /**
     * 爱心收益（参与奖）
     */
    @ApiModelProperty(value = "爱心收益（参与奖）")
    @TableField("love_balance")
    @Excel(name = "爱心收益（参与奖）")
    private BigDecimal loveBalance;

    /**
     * 分享红包
     */
    @ApiModelProperty(value = "分享红包")
    @TableField("share_balance")
    @Excel(name = "分享红包")
    private BigDecimal shareBalance;

    @TableField("primary_promoter_id")
    private Long primaryPromoterId;
    @TableField("primary_promoter_phone")
    @Excel(name = "一级推荐人")
    private String primaryPromoterPhone;
    @TableField("primary_promoter_level")
    @Excel(name = "属级")
    private Long primaryPromoterLevel;

    /**
     * 推荐链路
     */
    @ApiModelProperty(value = "推荐链路")
    @TableField(value = "promoter_list", condition = LIKE)
    @Excel(name = "")
    private String promoterList;
    @TableField(exist = false)
    private BigDecimal teamValue;
    @TableField(exist = false)
    private BigDecimal teamBalance;
    @TableField(exist = false)
    private BigDecimal consumerValue;
    @TableField(exist = false)
    private BigDecimal consumerBalance;
    @TableField(exist = false)
    private BigDecimal splitBalance;
    @TableField(exist = false)
    private BigDecimal smallBalance;

    @ApiModelProperty(value = "实名状态")
    @TableField("verify_status")
    private String verifyStatus;

    @ApiModelProperty(value = "实名手机号")
    @TableField("verify_phone")
    private String verifyPhone;

    @ApiModelProperty(value = "实名储蓄卡")
    @TableField("verify_card")
    private String verifyCard;

    @ApiModelProperty(value = "实名身份证")
    @TableField("verify_idNo")
    private String verifyIdNo;

    @ApiModelProperty(value = "实名姓名")
    @TableField("verify_name")
    private String verifyName;
    @ApiModelProperty(value = "是否商家")
    @TableField("is_merchant")
    private Integer isMerchant;
    @ApiModelProperty(value = "是否商家")
    @TableField("branch_level")
    private BranchLevelType branchLevelType;
    @ApiModelProperty(value = "是否商家")
    @TableField("agent_level")
    private AgentLevelType agentLevelType;
    @TableField("oem_code")
    private String oemCode;
    @TableField("first_pay")
    private Integer firstPay;
    @TableField("first_pay_time")
    private LocalDateTime firstPayTime;

    @Builder
    public Customer(Long id, LocalDateTime updateTime, Long updateUser, LocalDateTime createTime, Long createUser,
                    String loginName, String passWord, Long promoterId, LocalDateTime createDate, Integer customerType,
                    BigDecimal totalProfit, BigDecimal availableBalance, Integer status, String promoterMobile, String tradePass, BigDecimal totalCoupon,
                    BigDecimal coupon, String realName, String headImg, String nickName, BigDecimal spellValue, Long contributionValue,
                    Integer isSpell, BigDecimal spellBalance, BigDecimal contributionBalance, BigDecimal loveBalance, BigDecimal shareBalance, String promoterList,
                    String verifyStatus, String verifyPhone, String verifyCard, String verifyIdNo, String verifyName,Integer isMerchant,BranchLevelType branchLevelType,AgentLevelType agentLevelType,
                    Integer firstPay) {
        this.id = id;
        this.updateTime = updateTime;
        this.updateUser = updateUser;
        this.createTime = createTime;
        this.createUser = createUser;
        this.loginName = loginName;
        this.passWord = passWord;
        this.promoterId = promoterId;
        this.createDate = createDate;
        this.customerType = customerType;
        this.totalProfit = totalProfit;
        this.availableBalance = availableBalance;
        this.status = status;
        this.promoterMobile = promoterMobile;
        this.tradePass = tradePass;
        this.totalCoupon = totalCoupon;
        this.coupon = coupon;
        this.realName = realName;
        this.headImg = headImg;
        this.nickName = nickName;
        this.spellValue = spellValue;
        this.contributionValue = contributionValue;
        this.isSpell = isSpell;
        this.spellBalance = spellBalance;
        this.contributionBalance = contributionBalance;
        this.loveBalance = loveBalance;
        this.shareBalance = shareBalance;
        this.promoterList = promoterList;
        this.verifyStatus = verifyStatus;
        this.verifyPhone = verifyPhone;
        this.verifyCard = verifyCard;
        this.verifyIdNo = verifyIdNo;
        this.verifyName = verifyName;
        this.isMerchant = isMerchant;
        this.branchLevelType = branchLevelType;
        this.agentLevelType = agentLevelType;
        this.firstPay = firstPay;
    }

}
